﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using CCWin.SkinControl;

namespace 生命体征测试仪
{
    public partial class NumKey : UserControl
    {
        //定义委托
        public delegate void BtnClickHandle(int num);
        //定义事件
        public event BtnClickHandle NumKey_BtnClicked;
        public NumKey()
        {
            InitializeComponent();
        }
        public void Set1(string str)
        {
            skinButton12.Text = str;
            skinButton12.Font = new System.Drawing.Font("宋体", 20F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
        }
        private void Button_Click(object sender, EventArgs e)
        {
            if(NumKey_BtnClicked!=null)
            {
                SkinButton btn = (SkinButton)sender;
                switch (btn.Text)
                {
                    case "1":
                        NumKey_BtnClicked(1);
                        break;
                    case "2":
                        NumKey_BtnClicked(2);
                        break;
                    case "3":
                        NumKey_BtnClicked(3);
                        break;
                    case "4":
                        NumKey_BtnClicked(4);
                        break;
                    case "5":
                        NumKey_BtnClicked(5);
                        break;
                    case "6":
                        NumKey_BtnClicked(6);
                        break;
                    case "7":
                        NumKey_BtnClicked(7);
                        break;
                    case "8":
                        NumKey_BtnClicked(8);
                        break;
                    case "9":
                        NumKey_BtnClicked(9);
                        break;
                    case "0":
                        NumKey_BtnClicked(0);
                        break;
                    case "清除":
                        NumKey_BtnClicked(-1);
                        break;
                    default:
                        NumKey_BtnClicked(-2);
                        break;
                }
            }
        }
    }
}
